<!-- 搜索表单 -->
<template>
  <ele-card :body-style="{ paddingBottom: '2px' }">
    <el-form label-width="72px" @keyup.enter="search" @submit.prevent="">
      <el-row :gutter="8">
        <el-col :lg="6" :md="12" :sm="12" :xs="24">
          <el-form-item label="服务发生时间">
            <el-input clearable v-model.trim="form.serviceTime" placeholder="请输入" />
          </el-form-item>
        </el-col>
        <el-col :lg="6" :md="12" :sm="12" :xs="24">
          <el-form-item label="客户手机号">
            <el-input clearable v-model.trim="form.customerPhone" placeholder="请输入" />
          </el-form-item>
        </el-col>
        <el-col :lg="6" :md="12" :sm="12" :xs="24">
          <el-form-item label="客户姓名">
            <el-input clearable v-model.trim="form.customerName" placeholder="请输入" />
          </el-form-item>
        </el-col>
        <el-col :lg="6" :md="12" :sm="12" :xs="24">
          <el-form-item label="服务场景">
            <el-input clearable v-model.trim="form.serviceScene" placeholder="请输入" />
          </el-form-item>
        </el-col>
        <el-col :lg="6" :md="12" :sm="12" :xs="24">
          <el-form-item label="标签，多条用逗号隔开（如：分析成功,有效语音,优秀语音）">
            <el-input clearable v-model.trim="form.tags" placeholder="请输入" />
          </el-form-item>
        </el-col>
        <el-col :lg="6" :md="12" :sm="12" :xs="24">
          <el-form-item label="服务员工ID">
            <el-input clearable v-model.trim="form.userId" placeholder="请输入" />
          </el-form-item>
        </el-col>
        <el-col :lg="6" :md="12" :sm="12" :xs="24">
          <el-form-item label="所属组织ID">
            <el-input clearable v-model.trim="form.deptId" placeholder="请输入" />
          </el-form-item>
        </el-col>
        <el-col :lg="6" :md="12" :sm="12" :xs="24">
          <el-form-item label="服务时长（格式如：00:05:30）">
            <el-input clearable v-model.trim="form.serviceDuration" placeholder="请输入" />
          </el-form-item>
        </el-col>
        <el-col :lg="6" :md="12" :sm="12" :xs="24">
          <el-form-item label="质检评分（0-100）">
            <el-input clearable v-model.trim="form.qualityScore" placeholder="请输入" />
          </el-form-item>
        </el-col>
        <el-col :lg="6" :md="12" :sm="12" :xs="24">
          <el-form-item label="风险等级（0-无风险，1-低风险，2-中风险，3-高风险）">
            <el-input clearable v-model.trim="form.riskLevel" placeholder="请输入" />
          </el-form-item>
        </el-col>
        <el-col :lg="6" :md="12" :sm="12" :xs="24">
          <el-form-item label="是否存在风险（0-否，1-是）">
            <el-input clearable v-model.trim="form.hasRisk" placeholder="请输入" />
          </el-form-item>
        </el-col>
        <el-col :lg="6" :md="12" :sm="12" :xs="24">
          <el-form-item label="是否有效语音（0-否，1-是）">
            <el-input clearable v-model.trim="form.isEffective" placeholder="请输入" />
          </el-form-item>
        </el-col>
        <el-col :lg="6" :md="12" :sm="12" :xs="24">
          <el-form-item label="是否优秀语音（0-否，1-是）">
            <el-input clearable v-model.trim="form.isExcellent" placeholder="请输入" />
          </el-form-item>
        </el-col>
        <el-col :lg="6" :md="12" :sm="12" :xs="24">
          <el-form-item label="创建人">
            <el-input clearable v-model.trim="form.createdBy" placeholder="请输入" />
          </el-form-item>
        </el-col>
        <el-col :lg="6" :md="12" :sm="12" :xs="24">
          <el-form-item label="创建时间">
            <el-input clearable v-model.trim="form.createdTime" placeholder="请输入" />
          </el-form-item>
        </el-col>
        <el-col :lg="6" :md="12" :sm="12" :xs="24">
          <el-form-item label="修改人">
            <el-input clearable v-model.trim="form.updatedBy" placeholder="请输入" />
          </el-form-item>
        </el-col>
        <el-col :lg="6" :md="12" :sm="12" :xs="24">
          <el-form-item label="修改时间">
            <el-input clearable v-model.trim="form.updatedTime" placeholder="请输入" />
          </el-form-item>
        </el-col>
        <el-col :lg="6" :md="12" :sm="12" :xs="24">
          <el-form-item label-width="16px">
            <el-button type="primary" @click="search">查询</el-button>
            <el-button @click="reset">重置</el-button>
          </el-form-item>
        </el-col>
      </el-row>
    </el-form>
  </ele-card>
</template>

<script setup>
import { useFormData } from '@/utils/use-form-data';

const emit = defineEmits(['search']);

/** 表单数据 */
const [form, resetFields] = useFormData({
  serviceTime: '',
  customerPhone: '',
  customerName: '',
  serviceScene: '',
  tags: '',
  userId: void 0,
  deptId: void 0,
  serviceDuration: '',
  qualityScore: void 0,
  riskLevel: void 0,
  hasRisk: void 0,
  isEffective: void 0,
  isExcellent: void 0,
  createdBy: '',
  createdTime: '',
  updatedBy: '',
  updatedTime: ''
});

/** 搜索 */
const search = () => {
  emit('search', { ...form });
};

/**  重置 */
const reset = () => {
  resetFields();
  search();
};
</script>
